﻿using InterFace;
using Microsoft.AspNetCore.Mvc;
using Models.Entity;
using WebServer.Config;

namespace WebApplication2.Controllers;

[ApiController]
[Route("api/[controller]/[action]")]
public class NoticeController : Controller
{
    private readonly INoticeService _noticeService;

    public NoticeController(INoticeService noticeService)
    {
        _noticeService = noticeService;
    }

    [HttpGet]
    public async Task<Result> GetNotices()
    {
        return ResultHelper.Success(await _noticeService.GetNotices());
    }

    [HttpGet]
    public async Task<Result> GetTicketStatus()
    {
        return ResultHelper.Success(await _noticeService.GetTicketStatus());
    }
    
    [HttpGet]
    public async Task<Result> GetCompletionRate()
    {
        return ResultHelper.Success(await _noticeService.GetCompletionRate());
    }

    [HttpGet]
    public async Task<Result> GetTickets()
    {
        return ResultHelper.Success(await _noticeService.GetTickets());
    }
    [HttpGet]
    public async Task<Result> GetFaultTypeCounts()
    {
        return ResultHelper.Success(await _noticeService.GetFaultTypeCounts());
    }
    [HttpGet]
    public async Task<Result> GetDailyTicketTrend()
    {
        return ResultHelper.Success(await _noticeService.GetDailyTicketTrend());
    }
    [HttpGet]
    public async Task<Result> GetMonthlyTicketTrend()
    {
        return ResultHelper.Success(await _noticeService.GetMonthlyTicketTrend());
    }
    [HttpGet]
    public async Task<Result> GetAllDeviceFaultRanking()
    {
        return ResultHelper.Success(await _noticeService.GetAllDeviceFaultRanking());
    }
}